package threadException;

import java.util.concurrent.TimeUnit;

public class ThreadException {
    /**
     * 子线程出现异常，区别于子方法异常，整个程序并未终止
     * @param args
     */
    public static void main(String[] args) throws InterruptedException {
        System.out.println("主线程开始");
        new Thread(() -> {
            System.out.println("子线程开始");
            int i = 1/0;
            System.out.println("子线程结束");
        }).start();
        TimeUnit.SECONDS.sleep(2);
        System.out.println("主线程截至");
    }
}
